using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace PocketApps
{
    public partial class CheckList : Form
    {
        public CheckList()
        {
            InitializeComponent();
        }

        private void bnToDone_Click(object sender, EventArgs e)
        {

        }
        /*
         *         private void button2_Click(object sender, EventArgs e)
        {
            if (toggleToDo)
            {
                tcTodo.Visible = false;
                tcMain.Visible = true;
            }
            else
            {
                tcMain.Visible = false;
                tcTodo.Visible = true;
            }
            toggleToDo = !toggleToDo;
        }

        private void tcTodo_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (tcTodo.SelectedIndex)
            {
                case 0:
                    tpTodoPlain.SuspendLayout();
                    tbTodoText.Text = string.Empty;
                    StringBuilder todoSb = new StringBuilder();
                    for (int i = 0; i < lvTodoList.Items.Count; i++)
                    {
                        if (lvTodoList.Items[i].Checked)
                        {
                            todoSb.Append("x " + lvTodoList.Items[i].Text + "\r\n");
                        }
                        else
                        {
                            todoSb.Append("o " + lvTodoList.Items[i].Text + "\r\n");
                        }
                    }
                    // remove last linefeed
                    todoSb.Remove(todoSb.Length - 2, 2);
                    tbTodoText.Text = todoSb.ToString();
                    tpTodoPlain.ResumeLayout();
                    break;
                case 1:
                    tpTodoList.SuspendLayout();
                    lvTodoList.Items.Clear();
                    string todostring = tbTodoText.Text.Replace("\r\n", "|");
                    string[] rows = todostring.Split('|');
                    foreach (string todoitem in rows)
                    {
                        bool check = false;
                        string temp = todoitem;
                        if (todoitem.StartsWith("o "))
                        {
                            check = false;
                            temp = temp.Remove(0, 2);
                        }
                        else if (todoitem.StartsWith("x "))
                        {
                            check = true;
                            temp = temp.Remove(0, 2);
                        }

                        ListViewItem todolistitem = new ListViewItem(temp);
                        todolistitem.Checked = check;
                        lvTodoList.Items.Add(todolistitem);
                    }
                    tpTodoList.ResumeLayout();
                    break;

                default:
                    break;
            }
        }

        private void lvTodoList_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            if (!lvTodoList.Items[e.Index].Checked)
                lvTodoList.Items[e.Index].ForeColor = Color.Silver;
            else
                lvTodoList.Items[e.Index].ForeColor = Color.Black;
*/

    }
}